﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace Joyintech.BLL.inpiao365
{
    public partial class order_BLL
    {
        /// <summary>
        /// 获得分页订单列表
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public DataSet GetAllOrderList(int userId,int currentPage)
        {
            string strWhere = " a.CustomerId=" + userId;

            DataSet order = dal.GetOrderList(strWhere, currentPage);

            return order;
        }


        /// <summary>
        /// 获得已经预订的座位列表
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public DataSet GetLockSeatList(String lsh, String yth, String yyh, String cc)
        {
            StringBuilder strWhere = new StringBuilder(" a.MovieId=" + lsh);
            strWhere.Append(" and  a.TheaterRoomId=" + yth);
            strWhere.Append(" and  a.TheaterId=" + yyh);
            strWhere.Append(" and  a.ScreeningsId=" + cc);
            DataSet order = dal.GetOrderList(strWhere.ToString());
            return order;
        }

        /// <summary>
        /// 获得在限定时间内未支付的订单列表
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public DataSet GetOrderList(int userId)
        {
            DateTime nowdate = DateTime.Now.AddMinutes(-15);

            string strWhere = " a.OrderTime>='" + nowdate + "' and a.CustomerId=" + userId + "  order by a.OrderTime desc";

            DataSet order = dal.GetOrderList(strWhere);

            return order;
        }


        /// <summary>
        ///  获取与指定订单关联的信息
        /// </summary>
        /// <param name="orderid"></param>
        /// <returns></returns>
        public DataSet GetFullModel(int orderid)
        {
            DataSet order = dal.GetFullModel("OrderId=" + orderid);

            return order;
        }

        public int RecordCount(string orderid)
        {
            string strWhere = " CustomerId=" + orderid; 
            return dal.RecordCount(strWhere);
        }

    }
}
